//
//  AboutUsViewController.m
//  tryshopping.boss
//
//  Created by Mr.Lee on 2016/12/14.
//  Copyright © 2016年 Reabam. All rights reserved.
//

#import "AboutUsViewController.h"
#import "AboutUsHeaderView.h"

@interface AboutUsViewController ()
@end

@implementation AboutUsViewController
{
    NSArray *array;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"关于我们";
    [self setUpTableView];
}

- (void)setUpTableView{
    
    // 头部view
    AboutUsHeaderView *aboutUV = [AboutUsHeaderView aboutUsHeaderViewFromXib];
    aboutUV.backgroundColor = [UIColor whiteColor];
    aboutUV.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight-StatusBarAndNavigationBarHeight);
    
//    aboutUV.bundleNameLabel.text = [NSString stringWithFormat:@"v%@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]];
//    aboutUV.versionLabel.text = [NSString stringWithFormat:@"v%@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]];
    aboutUV.bundleNameLabel.text = [NSString stringWithFormat:@"v%@", [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]];
  
    
    NSString *introStr = @"睿本管理助手将门店生意管理装进口袋,让您随时随地监控门店运营数据、查看市场动态、把握最优资源、一键轻松进货和科学分析决策。";
    NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:introStr];
    
    // 从第0个,长度为2的字体大小为14号
    [AttributedStr addAttribute:NSFontAttributeName
     
                          value:[UIFont systemFontOfSize:15.0]
     
                          range:NSMakeRange(0, 6)];
    
    // 从第0个,长度为2的字体, 颜色红色
    [AttributedStr addAttribute:NSForegroundColorAttributeName
     
                          value:[UIColor colorWithHexString:@"333333"]
     
                          range:NSMakeRange(0, 6)];
    
    
    aboutUV.intro.attributedText=AttributedStr;
    [self.view addSubview:aboutUV];
    
    
//    self.tableV.tableHeaderView = aboutUV;
//    array = @[@"版权信息",@"商务合作",@"联系我们"];
//    self.tableV.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
//    self.tableV.separatorStyle=UITableViewCellSeparatorStyleNone;
//    self.tableV.backgroundColor = zuiqianhuiColor;
    
}

#pragma mark -- tableViewDelegate/Datasource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return array.count;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    cell.textLabel.textColor=[UIColor colorWithHexString:@"333333"];
    cell.textLabel.font=[UIFont systemFontOfSize:17];
    cell.textLabel.text = [array objectAtIndex:indexPath.row];
    if (indexPath.row==2) {
        
        UIButton*jiantou = [[UIButton alloc]init];
        jiantou.frame = CGRectMake(ScreenWidth-40,10, 30, 30);
        jiantou.userInteractionEnabled=NO;
        [jiantou setImage:[UIImage imageNamed:@"qiehuanyemain_normal"] forState:UIControlStateNormal];
        [cell.contentView addSubview:jiantou];
       
        
    }else {
        UILabel *lineLabel11=[[UILabel alloc] initWithFrame:CGRectMake(0,0, ScreenWidth, 0.35)];
        lineLabel11.backgroundColor=qianhuiColor;
        //        [cell.contentView addSubview:lineLabel11];
        UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 50-0.35, ScreenWidth-30, 0.3)];
        lineLabel1.backgroundColor=qianhuiColor;
        [cell.contentView addSubview:lineLabel1];
        UIButton*jiantou = [[UIButton alloc]init];
        jiantou.frame = CGRectMake(ScreenWidth-40,10, 30, 30);
        jiantou.userInteractionEnabled=NO;
        [jiantou setImage:[UIImage imageNamed:@"qiehuanyemain_normal"] forState:UIControlStateNormal];
        [cell.contentView addSubview:jiantou];
        
    }
    
    
    return cell;
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return  50;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    UITableViewCell *cell =(UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
    if ([cell.textLabel.text isEqualToString:@"版权信息"]) {
//        DLog(@"版权信息");
    } else if ([cell.textLabel.text isEqualToString:@"商务合作"]){
//        DLog(@"商务合作");
    } else{
//        DLog(@"联系我们");
    }
    
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [[self rdv_tabBarController] setTabBarHidden:YES animated:YES];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
}
@end
